package me.zhengjie.modules.region.domain;

import me.zhengjie.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.sql.Timestamp;

/**
* @author TianI
* @date 2022-01-27
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("sys_region")
public class SysRegion extends CommonModel<SysRegion> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "编号")
    @TableId(type= IdType.ASSIGN_ID)
    private String value;

    @ApiModelProperty(value = "名称")
    @NotBlank
    private String label;

    @ApiModelProperty(value = "父id")
    @NotBlank
    private String parentid;

    @ApiModelProperty(value = "简称")
    @NotBlank
    private String shortname;

    @ApiModelProperty(value = "级别")
    @NotBlank
    private String leveltype;

    @ApiModelProperty(value = "城市区号")
    @NotBlank
    private String citycode;

    @ApiModelProperty(value = "邮编")
    @NotBlank
    private String zipcode;

    @ApiModelProperty(value = "全名")
    @NotBlank
    private String mergername;

    @ApiModelProperty(value = "经度")
    @NotBlank
    private String lng;

    @ApiModelProperty(value = "纬度")
    @NotBlank
    private String lat;

    @ApiModelProperty(value = "拼音")
    @NotBlank
    private String pinyin;

    public void copyFrom(SysRegion source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
